fmridisplay overhaul: stateful controller, unified colour pipeline, visualization walkthrough#87
Merged
Merged
Conversation
…fixes
Interactive controller
- Auto-launch on construction (gated off in -batch / 'nocontroller'); restores
the current figure so it never hijacks montage/surface rendering; opens
top-right to avoid overlap.
- Threshold slider fixes: normalised [0 1] scale for raw |x| (uislider is
unreliable on tiny ranges), double-cast (data-derived thresholds are single),
numeric entry field, out-of-range shows an empty map.
- Split-colormap legend: 4 numeric labels + gap, live-updating with cmaprange.
- Colour bar renders via uiimage (fills the cell); larger legend font.
- Echoed code + title use the caller's real workspace variable name.
Layouts / entry points
- New fmridisplay.multiview method exposing all canlab_results_fmridisplay
compositions (compact/compact2/full/multirow/hcp/freesurfer/subcortex/...).
- canlab_results_fmridisplay reuses a passed-in object: composes onto it if it
has no montages, else just adds blobs (long-standing reuse preserved).
- fmridisplay.montage default routes through multiview('compact') (sag+axial
combo, matching fmri_data.montage) and echoes the equivalent call.
- montage pulls existing blob layers onto a newly added montage; surface
multi-keyword path (foursurfaces_hcp, ...) routes through addbrain.
Uniform colour scaling
- Shared canlab_default_cmaprange: robust per-arm percentile default used by
montages, render_on_surface, and the surface path (no more min/max vs
percentile divergence).
Consistency / robustness fixes
- Shared canlab_is_uifigure: never draw slices/surfaces into the controller
uifigure (open a fresh figure instead) across all entry points.
- removeblobs clears surface-only layers (no montage blobhandles).
- Multi-image objects handled without errors: montage() lays out a per-image
(multirow) display (fixed existing_axes expansion for a single placeholder
axis with many slices); addblobs() uses the first image only.
- Hide the per-axes "..." interaction toolbar on montage slices and rendered
surfaces (canlab_hide_axes_toolbar).
Tests
- Add regression tests: existing_axes expansion, multi-image montage/addblobs,
multiview compose+pull-in; update the split-legend label test. 47/47 pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ZJacdhhByLGXqGHH9YQeo
…lormap
Unify montage value->colour with the surface path by building the central
canlab_colormap for EVERY mode, not just split/single. Previously solid,
continuous ('colormap' LUT) and indexed ('indexmap'/atlas) blobs used legacy
inline render_blobs paths that bypassed canlab_colormap; the indexmap path was
also buggy (broken sub2ind assignment). Now:
- render_blobs builds central_cm for split, single, solid, continuous and
indexed, and colours every slice via central_map_slice (one code path).
- canlab_colormap.map is NaN/Inf-robust for indexed and continuous, matching
the legacy guards, since blob slices contain out-of-blob NaN voxels.
Montage and surface of the same data now produce identical value->colour
mappings across all colour modes (verified max|dRGB|=0), and the buggy indexmap
rendering is removed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Route indexed (indexmap/atlas) layers through the central canlab_colormap everywhere, so montage, surface, and the controller legend all agree: - canlab_colormap.from_render_args now builds an 'indexed' colormap for indexmap layers (was falling through to the default mango split). - controller: indexed layers show an 'indexed (atlas)' label, the region's solid colour as the swatch/stripe (not the whole palette), and blank the meaningless numeric range labels. - render_layer_surfaces: index/atlas surfaces render through the same true-colour central-colormap path as every other mode (nearest-neighbour sampling to preserve integer indices), replacing the render_on_surface legacy indexmap branch. Verified: surface vertex colours equal cmap(region_index) exactly (d=0) and match the montage; split/single/solid/continuous unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Multi-page markdown walkthrough of CanlabCore visualization methods: getting started, montages, surfaces, colormaps, the fmridisplay controller GUI with command-line equivalents, and atlases/regions. Includes per-section figure generators (_gen/) and embedded figures. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ogs, master script
Applies the 8 approved revisions to the visualization walkthrough (docs only):
- §1: OO-API intro (methods return manipulable fmridisplay objects); add
canlab_orthviews (SPM-free) + pointer to the canlab_niivue web viewer.
- §2.6: custom montage via fmridisplay.montage (orientation/slice_range/spacing).
- §3.4/§3.6: addbrain help pointers + full surface & composite catalog.
- §5.4: montage-set and surface-layout catalog.
- §6: atlas object help, atlas-type table, Neuroimaging_Pattern_Masks dependency.
- Clean surface figures without colorbar legends; new 01_canlab_orthviews.png
and 02_custom_montage.png.
- Add master script _gen/visualization_walkthrough.m (one section per page,
regenerates all figures; ran clean in R2026a); referenced from §1 and index.
- Remove temporary _gen/gen_revise.m; fix R2026a func(){:} syntax in docs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ADME doc sections - Object_methods.md "Visualizing images and results": add a callout linking the new visualization_walkthrough/index.md as the hands-on starting point. - README.md: reorganize the documentation list into "In this repository" vs "Online", adding the visualization walkthrough, workflows, and markdown tutorials sections alongside the existing Object methods reference. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Overhauls the
fmridisplaydisplay stack and adds a full multi-page visualization walkthrough. Two themes:1. Display engine + colour pipeline
@fmridisplay/controller.m,multiview.m): layers remember their source data and options, so montages and surfaces re-threshold/recolour/re-render live from one handle object. Every GUI control has a one-line command-line twin.render_blobs.m,canlab_colormap.m,canlab_default_cmaprange.m): all montage modes (split / single / solid / continuous / indexed) build a singlecentral_cmand colour throughcentral_map_slice; the buggy indexmapsub2indpath and legacy continuousmap_functionpath are removed. Result:max|dRGB| = 0across montage modes, and surface indexmap vertex colours equalcmap(region_index)exactly.render_layer_surfaces.m,render_on_surface.m): all modes incl. indexed/atlas route through the truecolor path with'interp','nearest'for indexed; controller/surface legend handling for indexed atlases fixed.addblobs/removeblobs/surface/montagemethod updates,canlab_results_fmridisplayoptions, uifigure helpers (canlab_is_uifigure,canlab_hide_axes_toolbar), and expandedcanlab_test_fmridisplay_handlecoverage.2. Visualization walkthrough (
docs/visualization_walkthrough/)A hands-on, six-page guide pairing runnable code with the figure it produces, covering montages, 3-D surfaces, the interactive controller, colormaps, and atlases:
index.md,01_getting_started…06_atlases_and_regions.canlab_orthviews+ a pointer to thecanlab_niivueweb viewer; OO-API intro; custom montages viafmridisplay.montage; full catalogs of surfaces, composites, and montage-sets; atlas object help and theNeuroimaging_Pattern_Masksdependency._gen/visualization_walkthrough.m— one section per page (1.1 … 6.5) — regenerates every figure; per-pagegen_0*.mgenerators kept for single-page regen. Verified: runs end-to-end clean in MATLAB R2026a.Also removes stray Dropbox conflict temp files under
Unit_tests/walkthroughs/private/and minor typo/codespell fixes.Test plan
canlab_test_fmridisplay_handle(extended) passes._gen/visualization_walkthrough.mruns end-to-end in R2026a, regenerating all figures with no errors.max|dRGB| = 0across split/single/solid/continuous montage modes; surface indexmap vertex colours matchcmap(region_index)(d=0).🤖 Generated with Claude Code